# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.CloudChannel.V1.Model.GoogleCloudChannelV1alpha1DateRange do
  @moduledoc """
  A representation of usage or invoice date ranges.

  ## Attributes

  *   `invoiceEndDate` (*type:* `GoogleApi.CloudChannel.V1.Model.GoogleTypeDate.t`, *default:* `nil`) - The latest invoice date (inclusive). If this value is not the last day of a month, this will move it forward to the last day of the given month.
  *   `invoiceStartDate` (*type:* `GoogleApi.CloudChannel.V1.Model.GoogleTypeDate.t`, *default:* `nil`) - The earliest invoice date (inclusive). If this value is not the first day of a month, this will move it back to the first day of the given month.
  *   `usageEndDateTime` (*type:* `GoogleApi.CloudChannel.V1.Model.GoogleTypeDateTime.t`, *default:* `nil`) - The latest usage date time (exclusive). If you use time groupings (daily, weekly, etc), each group uses midnight to midnight (Pacific time). The usage end date is rounded down to include all usage from the specified date. We recommend that clients pass `usage_start_date_time` in Pacific time.
  *   `usageStartDateTime` (*type:* `GoogleApi.CloudChannel.V1.Model.GoogleTypeDateTime.t`, *default:* `nil`) - The earliest usage date time (inclusive). If you use time groupings (daily, weekly, etc), each group uses midnight to midnight (Pacific time). The usage start date is rounded down to include all usage from the specified date. We recommend that clients pass `usage_start_date_time` in Pacific time.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :invoiceEndDate => GoogleApi.CloudChannel.V1.Model.GoogleTypeDate.t() | nil,
          :invoiceStartDate => GoogleApi.CloudChannel.V1.Model.GoogleTypeDate.t() | nil,
          :usageEndDateTime => GoogleApi.CloudChannel.V1.Model.GoogleTypeDateTime.t() | nil,
          :usageStartDateTime => GoogleApi.CloudChannel.V1.Model.GoogleTypeDateTime.t() | nil
        }

  field(:invoiceEndDate, as: GoogleApi.CloudChannel.V1.Model.GoogleTypeDate)
  field(:invoiceStartDate, as: GoogleApi.CloudChannel.V1.Model.GoogleTypeDate)
  field(:usageEndDateTime, as: GoogleApi.CloudChannel.V1.Model.GoogleTypeDateTime)
  field(:usageStartDateTime, as: GoogleApi.CloudChannel.V1.Model.GoogleTypeDateTime)
end

defimpl Poison.Decoder, for: GoogleApi.CloudChannel.V1.Model.GoogleCloudChannelV1alpha1DateRange do
  def decode(value, options) do
    GoogleApi.CloudChannel.V1.Model.GoogleCloudChannelV1alpha1DateRange.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.CloudChannel.V1.Model.GoogleCloudChannelV1alpha1DateRange do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
